#include"../Common/httplib.h"



int main()
{
    //1.实例化服务器对象
    httplib::Server server;
    //2.注册回调函数 函数的形式必须是void(const httplib::Request& ,httplib::Response&)
    server.Get("/test",[](const httplib::Request& req,httplib::Response& resp)
    {
        std::cout<<req.method<<std::endl;
        std::cout<<req.path<<std::endl;
        for(auto e:req.headers)
            std::cout<<e.first<<" "<<e.second<<std::endl;
        std::string body ="<http><body><h1>this is a ez test</h1></body></http>";
        resp.set_content(body,"text/html");
        resp.status = 200;
    });
    //server.Post();
    //3.启动服务器
    server.listen("0.0.0.0",9090);
    return 0;
};